package learn_concurrent._7;

import java.util.concurrent.locks.ReentrantLock;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class T3 {
	static final Logger logger = LoggerFactory.getLogger(T3.class);
	
	
	static final ReentrantLock LOCK = new ReentrantLock();
	public static void main(String[] args) {
		LOCK.lock();
		try {
			logger.info("main...");
			m1();
		} finally {
			LOCK.unlock();
		}
	}
	
	private static void m1() {
		LOCK.lock();
		try {
			logger.info("m1...");
			m2();
		} finally {
			LOCK.unlock();
		}
	}
	
	private static void m2() {
		LOCK.lock();
		try {
			logger.info("m2...");
		} finally {
			LOCK.unlock();
		}
	}

}
